package testDataGenerator.model.generationMethod;

import testDataGenerator.model.DataType;
import testDataGenerator.model.DataTypeFactory;
import testDataGenerator.model.GenerationMethod;

public class IncrementalMethod implements GenerationMethod {
	private int step;
	private DataType dt;
	private DataTypeFactory factory;

	public IncrementalMethod(String start, String step, String type, DataTypeFactory factory) {
		this.factory = factory;
		dt = this.factory.createDataType(type, start);
		this.step = new Integer(step).intValue();
		dt.minus(this.step);
	}

	public String generate() {
		String data = dt.next(step);
		dt = factory.createDataType(dt.getName(), data);
		return data;
	}

}
